home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / strategy / xpat2-1.000 / xpat2-1 / xpat2-1.04 / src / X-expose.c < prev    next >
C/C++ Source or Header  |  1994-09-28  |  1KB  |  50 lines

  1. /*****************************************************************************/
  2. /*                                         */
  3. /*                                         */
  4. /*    X patience version 2 -- module X-expose.c                 */
  5. /*                                         */
  6. /*    Routines for marking exposed cards                     */
  7. /*    written by Heiko Eissfeldt and Michael Bischoff                 */
  8. /*    see COPYRIGHT.xpat2 for Copyright details                 */
  9. /*                                         */
  10. /*                                         */
  11. /*****************************************************************************/
  12. #include "X-pat.h"
  13.  
  14. static int rem_y = -1;
  15. static Pixmap exp_bkp = 0;
  16.  
  17.  
  18. static void hide_exposed_card(void)
  19. {   if (rem_y < 0)
  20.     return;
  21.     XCopyArea(dpy, exp_bkp, table, whitegc, 0, 0, CARD_WIDTH, CARD_HEIGHT,
  22.           graphic.pile[getpile(graphic.zoomed_card)].x, rem_y);
  23.     rem_y = -1;
  24.     graphic.zoomed_card = -1;
  25. }
  26.  
  27. void show_exposed_card(boolean on)
  28. {
  29.     if (graphic.zoomed_card < 0)
  30.     return;
  31.     if (!exp_bkp)
  32.     exp_bkp = XCreatePixmap(dpy, table, CARD_WIDTH, CARD_HEIGHT,
  33.                 DefaultDepth(dpy, screen));
  34.     if (on) {
  35.         struct pile *p;
  36.     Cardindex ind;
  37.     ind = graphic.zoomed_card;
  38.     p = graphic.pile + getpile(ind);
  39.     rem_y = p->y + p->delta * (ind - game.ind[getpile(ind)]);
  40.     /* save bk */
  41.     XCopyArea(dpy, table, exp_bkp, whitegc, p->x, rem_y,
  42.           CARD_WIDTH, CARD_HEIGHT, 0, 0);
  43.     /* expose card */
  44.     PaintCard(p->x, rem_y,
  45.           (game.visible[ind] ? game.cards[ind] : CARDBACK), 0);
  46.     } else {
  47.     hide_exposed_card();
  48.     }
  49. }
  50.